<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: Topic</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: Topic</h1>

    




<section>

<header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>Topic<span class="signature">(options)</span><span class="type-signature"></span></h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    
    <h4 class="name" id="Topic"><span class="type-signature"></span>new Topic<span class="signature">(options)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Publish and/or subscribe to a topic in ROS.

Emits the following events:
 * 'warning' - if there are any warning during the Topic creation
 * 'message' - the message data from rosbridge
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>options</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last">object with following keys:
  * ros - the ROSLIB.Ros connection handle
  * name - the topic name, like /cmd_vel
  * messageType - the message type, like 'std_msgs/String'
  * compression - the type of compression to use, like 'png'
  * throttle_rate - the rate (in ms in between messages) at which to throttle the topics
  * queue_size - the queue created at bridge side for re-publishing webtopics (defaults to 100)
  * latch - latch the topic when publishing
  * queue_length - the queue length at bridge side used when subscribing (defaults to 0, no queueing).
  * reconnect_on_close - the flag to enable resubscription and readvertisement on close event(defaults to true).</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line28">line 28</a>
    </li></ul></dd>
    

    

    

    
</dl>


















    
    </div>

    

    

    

    

    

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    
    <h4 class="name" id="advertise"><span class="type-signature"></span>advertise<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Registers as a publisher for the topic.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line143">line 143</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="publish"><span class="type-signature"></span>publish<span class="signature">(message)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Publish the message.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>message</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last">A ROSLIB.Message object.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line190">line 190</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="subscribe"><span class="type-signature"></span>subscribe<span class="signature">(callback)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Every time a message is published for the given topic, the callback
will be called with the message object.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last">function with the following params:
  * message - the published message</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line89">line 89</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="toStream"><span class="type-signature"></span>toStream<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Publish a connected ROS topic to a duplex
stream. This stream can be piped to, which will
publish to the topic
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="node_TopicStream.js.html">node/TopicStream.js</a>, <a href="node_TopicStream.js.html#line16">line 16</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="unadvertise"><span class="type-signature"></span>unadvertise<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Unregisters as a publisher for the topic.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line169">line 169</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="unsubscribe"><span class="type-signature"></span>unsubscribe<span class="signature">(callback)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    Unregisters as a subscriber for the topic. Unsubscribing stop remove
all subscribe callbacks. To remove a call back, you must explicitly
pass the callback function in.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last">the optional callback to unregister, if
    * provided and other listeners are registered the topic won't
    * unsubscribe, just stop emitting to the passed listener</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="core_Topic.js.html">core/Topic.js</a>, <a href="core_Topic.js.html#line118">line 118</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ActionClient.html">ActionClient</a></li><li><a href="ActionListener.html">ActionListener</a></li><li><a href="Goal.html">Goal</a></li><li><a href="Message.html">Message</a></li><li><a href="Param.html">Param</a></li><li><a href="Pose.html">Pose</a></li><li><a href="Quaternion.html">Quaternion</a></li><li><a href="Ros.html">Ros</a></li><li><a href="Service.html">Service</a></li><li><a href="ServiceRequest.html">ServiceRequest</a></li><li><a href="ServiceResponse.html">ServiceResponse</a></li><li><a href="SimpleActionServer.html">SimpleActionServer</a></li><li><a href="TFClient.html">TFClient</a></li><li><a href="Topic.html">Topic</a></li><li><a href="Transform.html">Transform</a></li><li><a href="UrdfBox.html">UrdfBox</a></li><li><a href="UrdfColor.html">UrdfColor</a></li><li><a href="UrdfCylinder.html">UrdfCylinder</a></li><li><a href="UrdfJoint.html">UrdfJoint</a></li><li><a href="UrdfLink.html">UrdfLink</a></li><li><a href="UrdfMaterial.html">UrdfMaterial</a></li><li><a href="UrdfMesh.html">UrdfMesh</a></li><li><a href="UrdfModel.html">UrdfModel</a></li><li><a href="UrdfSphere.html">UrdfSphere</a></li><li><a href="UrdfVisual.html">UrdfVisual</a></li><li><a href="Vector3.html">Vector3</a></li></ul><h3>Global</h3><ul><li><a href="global.html#ROSLIB">ROSLIB</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Jan 04 2018 06:07:01 GMT+0000 (UTC)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>